<?php
class keu_verifikasi_model extends MY_Model {
	var $model = 'keu_verifikasi';
	
	
	function GetJSON()
	{
		$ls_sql	= "	SELECT	TRANS.ID_DOK, OFC.NAMA_KANTOR, TO_CHAR(TRANS.TGL_TRANSAKSI,'DD/MM/YYYY') TGL_TRANSAKSI, TRANS.KETERANGAN,
							TRANS.KD_VALUTA
					FROM	KEU_TRANSAKSI TRANS, SW_KANTOR OFC
					WHERE	
							OFC.KD_KANTOR = TRANS.KD_KANTOR  AND
							NVL(TRANS.STATUS_VERIFIKASI,'N') = 'N'	 AND
							TRANS.TGL_TRANSAKSI BETWEEN TO_DATE('".date_format3(post('date_from'), 'YYYY-MM-DD')."', 'YYYY-MM-DD') and TO_DATE('".date_format3(post('date_to'), 'YYYY-MM-DD')."','YYYY-MM-DD')
					ORDER BY ".(post('sort')=='' ? 'TRANS.TGL_TRANSAKSI' : post('sort'))." ".(post('order')=='' ? 'ASC' : post('order'));
					
		return json_encode( $this->paging($ls_sql) );
	}
	
	
	function GetDetailJSON($as_doc='')
	{
		$ls_sql	= "	SELECT	*
					FROM	KEU_TRANSAKSI_DETAIL
					WHERE DOC_ID = '".$as_doc."'";
		$result	= $this->db->query($ls_sql);			
		return json_encode( $result->row_array() );
	}
	
	function Update($arr_data, $arr_rule){
		$this->db->update('KEU_TRANSAKSI', $arr_data, $arr_rule);
	}
}
?>